package com.igor.bookStore.tapestry.pages;

import java.util.LinkedList;

import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SetupRender;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.igor.bookStore.beans.BookBean;
import com.igor.bookStore.inface.Book;
import com.igor.bookStore.inface.Purchase;
import com.igor.bookStore.inface.PurchaseItem;
import com.igor.bookStore.service.Books;

public class EntryBook {

	 @Property
     @Persist
     private Book book;

     @Inject
     private Books books;

     @SetupRender
     public void createObject() {
             book = new BookBean();
             book.setPurchaseItem(new LinkedList<PurchaseItem>());
     }

     public void onSuccess() {
             books.save(book);
     }

	}



